import { defineConfig } from 'vite';
import { crx } from '@crxjs/vite-plugin';
import vue from '@vitejs/plugin-vue';
import manifest from './src/manifest.js';

// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
  const production = mode === 'production';

  return {
    build: {
      emptyOutDir: true,
      outDir: 'build',
      rollupOptions: {
        output: {
          assetFileNames: (assetInfo) => {
            return `assets/js/chunk-[hash].[ext]`;
          },
        },
      },
    },
    plugins: [crx({ manifest }), vue()],
  };
});
